<!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<script type="text/javascript" src="user/scripts/register.js?{VERHASH}"></script>
<script src="admin/member/scripts/orguser.js?{VERHASH}"></script>
<script type="text/javascript">
	var selorg={};
	selorg.add=function(ctrlid,vals){
		if(vals[0].orgid=='other') vals[0].path='请选择机构或部门';
		jQuery('#'+ctrlid+'_Menu').html(vals[0].path+' <span class="caret"></span>');
		jQuery('#sel_'+ctrlid).val(vals[0].orgid).trigger('change');
	}
</script>
<style>
html,body{
	overflow:hidden;
	background:#FBFBFB;
}
.bs-left-container{
	width:120px;
	top:0;
}
.bs-main-container{
	margin-left:120px;
	overflow:auto;
}


</style>
<!--{template common/header_simple_end}-->

<div class="bs-container clearfix" style="padding-top:0">
  <div class="bs-left-container  clearfix">
    <!--{template left}--> 
  </div>
  <div class="left-drager">
     <div class="left-drager-op"><div class="left-drager-sub"></div></div>
  </div>
      
  <div class="bs-main-container  clearfix" > 
  	<div class="main-header" style="padding:0 15px">
        <ul class="nav nav-pills nav-pills-bottomguide">
              <li><a href="{BASESCRIPT}?mod=member">成员列表</a></li>
              <li class="active"><a href="{BASESCRIPT}?mod=member&op=edituser&uid=$uid">基本资料</a></li>
              <li><a href="{BASESCRIPT}?mod=member&op=edituser&do=profile&uid=$uid">详细资料</a></li>
             <!-- <li><a href="{BASESCRIPT}?mod=member&op=import">从文件导入</a></li>
               <li><a href="{BASESCRIPT}?mod=member&op=invite">Email邀请</a></li>-->
        </ul>
    </div>


<div class="main-body" style="padding:15px 15px 15px 22px;">
  <div id="return_edituser" style="display:none"></div>
  <form id="accountform" name="accountform" class="form-horizontal form-horizontal-left" action="{BASESCRIPT}?mod=member&op=edituser" method="post" onsubmit="account_submit();return false">
    <input type="hidden" name="accountedit" value="true" />
    <input type="hidden" name="uid" value="$uid" />
    <input type="hidden" name="handlekey" value="edituser" />
  	<input type="hidden" name="formhash" value="{FORMHASH}" />
      <div class="form-group">
        <label class="control-label" for="email">登录邮箱</label>
        <div class="controls">
          <input type="text" class="form-control input-sm" id="email" name="email" autocomplete="off" value="$user[email]" onblur="checkemail(this.id);" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
          <p  id="emailmore" style="height:1px;margin:0;">&nbsp;</p>
        </div>
          <span id="chk_email" class="help-inline">
                <span id="suc_email"></span><kbd class="p_chk"></kbd> 
                 必填，可用于系统登录
          </span>
      </div>
      <div class="form-group">
        <label class="control-label" for="nickname">登录用户名</label>
        <div class="controls">
          <input type="text" class="form-control input-sm" id="nickname" name="nickname" placeholder="登录用户名（选填）" autocomplete="off" value="$user[nickname]" onblur="checknick(this.id);" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
        </div>
          <span id="chk_nickname" class="help-inline">
                <span id="suc_nickname"></span><kbd class="p_chk"></kbd> 
                选填，可用于系统登录，员工关注企业号时，会根据员工的邮箱来匹配。
          </span>
      </div>
      <div class="form-group">
          <label class="control-label" for="username">姓 名</label>
          <div class="controls">
            <input type="text" class="form-control input-sm" class="form-control input-sm" placeholder="用户真实姓名" id="username" name="username" autocomplete="off" value="$user[username]" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
          </div>
           <span id="chk_username" class="help-inline">必填，系统中显示，便于同事辨识</span>
      </div> 
       <div class="form-group">
          <label class="control-label" for="username">手机号码</label>
          <div class="controls">
            <input type="text" class="form-control input-sm" class="form-control input-sm" placeholder="微信绑定的手机号码" id="phone" name="phone" autocomplete="off" value="$user[phone]" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
          </div>
           <span id="chk_phone" class="help-inline">选填，微信绑定的手机号码，员工关注企业号时，会根据员工微信绑定的手机来匹配。</span>
      </div>
     
       <div class="form-group">
          <label class="control-label" for="username">微信号</label>
          <div class="controls">
            <input type="text" class="form-control input-sm" class="form-control input-sm" placeholder="员工微信号" id="weixinid" name="weixinid" autocomplete="off" value="$user[weixinid]" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
          </div>
           <span id="chk_weixinid" class="help-inline">选填，员工微信号，员工关注企业号时，会根据员工的微信号来匹配。如果已经关注，此项不能修改。</span>
      </div>
      <div class="form-group">
        <label class="control-label" for="password">登录密码</label>
        <div class="controls">
          <input type="text" class="form-control input-sm" name="password" autocomplete="off" id="password" placeholder="留空，不修改密码" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
           </div>
            <span id="chk_password" class="help-inline">
                <span id="suc_password"></span>
                <kbd id="chk_password" class="p_chk"></kbd>
            </span>
       
      </div>
      <div class="form-group">
          <label class="control-label" for="password2">确认密码</label>
          <div class="controls">
            <input type="text" class="form-control input-sm" id="password2" name="password2" autocomplete="off" placeholder="留空，不修改密码" <!--{if !$perm}-->disabled="disabled"<!--{/if}-->>
            </div>
            <span id="chk_password2" class="help-inline">
                <span id="suc_password2"></span>
                <kbd id="chk_password2" class="p_chk"></kbd>
            </span>
          
        </div>
        <div class="form-group">
          <label class="control-label" for="addsize">额外空间</label>
          <div class="controls"  style="width:180px;">
          	<div class="input-group " >
            <input type="text" class="form-control input-sm" style="width:146px;" id="addsize" <!--{if $_G['adminid']!=1 || !$perm}-->disabled="disabled"<!--{/if}--> name="addsize" value="$userfield[addsize]" autocomplete="off" >
            <span class="input-group-addon">M</span>
            </div>
          </div> 
          <span class="help-inline">单位M，额外增加用户存储空间（用户的总空间=默认空间+额外空间）</span>
       </div> 
     	 <div class="form-group">
         	<label class="control-label" for="">停用此用户</label>
            <div class="controls ml20" style="width:160px;">
                   	<label class="checkbox-inline" ><input type="checkbox" name="status" <!--{if $_G['adminid']!=1 || !$perm}-->disabled="disabled"<!--{/if}--> value="1" <!--{if $user[status]}-->checked<!--{/if}-->>停用</label>
            </div> <span class="help-inline">用户停用后，该用户将不能登录系统，请谨慎操作</span>
      </div> 
      <div class="form-group">
         	<label class="control-label" for="">系统权限</label>
            <div class="controls ml20" style="width:160px;">
                   	<label class="checkbox-inline" ><input type="checkbox" name="adminid" <!--{if !$perm}-->disabled="disabled"<!--{/if}--> value="1" <!--{if $user[adminid]==1}-->checked<!--{/if}-->>设为系统管理员</label>
            </div> <span class="help-inline">设置用户为系统管理员后，此用户将拥有系统管理权限，请慎重！</span>
      </div> 
      
     <div class="form-group">
          <label class="control-label" for="depart">部门职位&nbsp;[&nbsp;<a href="javascript:;" class="glyphicon glyphicon-plus" onclick="addorgsel()" title="增加一项"></a>&nbsp;]</label> 
          
          <div id="selorg_container" class="controls selorg-container">
          		<!--{loop $data_depart $orgid $value}-->
                	<ul class="nav nav-pills mb10">
                     <li class="dropdown org">
                         <input id="sel_orgid_{$orgid}" type="hidden" name="orgids[]"  value="$orgid" onchange="selDepart(this)" />
                          <button type="button" id="orgid_{$orgid}_Menu" class="btn btn-default dropdown-toggle" data-toggle="dropdown" <!--{if !$value['ismoderator']}-->disabled<!--{/if}-->>
                            $value['depart'] <span class="caret"></span>
                          </button>
                          <div id="orgid_{$orgid}_dropdown_menu" class="dropdown-menu org-sel-box" role="menu" aria-labelledby="orgid_{$orgid}_Menu">
                               <iframe name="orgid_{$orgid}_iframe" class="org-sel-box-iframe" src="index.php?mod=system&op=orgtree&ctrlid=orgid_{$orgid}&nouser=1&moderator=1" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" allowtransparency="true" ></iframe>
                          </div>
                      </li>
                     <li class="dropdown job">
                     	<input type="hidden" name="jobids[]" value="$value[jobid]" />
                          <!--{if $value[jobname]}-->
                         <button type="button"  data-toggle="dropdown" role="button" _jobid="$value[jobid]"  class="dropdown-toggle btn btn-simple jobid" <!--{if !$value['ismoderator']}-->disabled<!--{/if}-->><span>$value[jobname]<b class="caret"></b></span></button>
                          <!--{else}-->
                          <button type="button"  data-toggle="dropdown" role="button" _jobid="0"  class="dropdown-toggle btn btn-simple jobid"><span>无</span><b class="caret"></b></button>
                          <!--{/if}-->
                            <ul aria-labelledby="drop-depart" role="menu" class="dropdown-menu"  >
                            	  <li role="presentation"><a href="javascript:;" tabindex="-1" role="menuitem" _jobid="0" onclick="selJob(this)">无</a></li>
                                  <!--{loop $value[jobs] $value1}--> 
                                  <li role="presentation"><a href="javascript:;" tabindex="-1" role="menuitem" _jobid="$value1['jobid']" onclick="selJob(this)">$value1[name]</a></li>
                                  <!--{/loop}-->
                            </ul>
                      </li>
                     <!--{if $value['ismoderator']}--> <li ><span  onclick="delDepart(this)" title="删除"><i class="ibtn glyphicon glyphicon-remove"></i></span></li><!--{/if}-->
                 </ul> 
                 <!--{/loop}-->
                    <ul id="nav" class="nav nav-pills mb10">
                     <li class="dropdown org">
                         <input id="sel_orgid_tpml" type="hidden" name="orgids[]"  value="0" onchange="selDepart(this)" />
                          <button type="button" id="orgid_tpml_Menu" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
                            请选择机构或部门 <span class="caret"></span>
                          </button>
                          <div id="orgid_tpml_dropdown_menu" class="dropdown-menu org-sel-box" role="menu" aria-labelledby="orgid_tpml_Menu">
                               <iframe name="orgid_tpml_iframe" class="org-sel-box-iframe" src="index.php?mod=system&op=orgtree&ctrlid=orgid_tpml&nouser=1&moderator=1" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" allowtransparency="true" ></iframe>
                          </div>
                      </li>
                      <li class="dropdown job">
                      	  <input type="hidden" name="jobids[]" value="0" />
                          <button type="button"  data-toggle="dropdown" role="button" _job="0"  class="dropdown-toggle btn btn-simple jobid"><span>无</span><b class="caret"></b></button>
                            <ul aria-labelledby="drop-job" role="menu" class="dropdown-menu"  ></ul>
                      </li>
                      <li><span onclick="delDepart(this)" title="删除"><i class="ibtn glyphicon glyphicon-remove"></i></span></li>
                   </ul>
               
              
          </div>
        </div>
       <div class="form-group">
      	<label class="control-label" for="">上司职位</label>
        <div id="upjob" class="controls selorg-container">
        	<ul  class="nav nav-pills">
                 <li class="dropdown org">
                        <input id="sel_uporgid" type="hidden" name="uporgid"  value="$upjob[orgid]" onchange="selDepart(this)" />
                          <button type="button" id="uporgid_Menu" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
                            $upjob[depart] <span class="caret"></span>
                          </button>
                          <div id="uporgid_dropdown_menu" class="dropdown-menu org-sel-box" role="menu" aria-labelledby="uporgid_Menu">
                               <iframe name="uporgid_iframe" class="org-sel-box-iframe" src="index.php?mod=system&op=orgtree&ctrlid=uporgid&nouser=1" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" allowtransparency="true" ></iframe>
                         </div>
                  </li>
                  <li class="dropdown job">
                  		<input type="hidden" name="upjobid"  value="$upjob[jobid]">
                  	<!--{if $upjob}-->
                      <button type="button"  data-toggle="dropdown" role="button" _jobid="$upjob[jobid]"  class="dropdown-toggle btn btn-simple jobid"><span>$upjob[name]</span><b class="caret"></b></button>
                      <!--{else}-->
                      <button type="button"  data-toggle="dropdown" role="button" _jobid="0"  class="dropdown-toggle btn btn-simple jobid"><span>无</span><b class="caret"></b></button>
                      <!--{/if}-->
                        <ul aria-labelledby="drop-job" role="menu" class="dropdown-menu"> 
                        	 <li role="presentation"><a href="javascript:;" tabindex="-1" role="menuitem" _jobid="0" onclick="selJob(this)">无</a></li>
                              <!--{loop $upjob[jobs] $value}--> 
                              <li role="presentation"><a href="javascript:;" tabindex="-1" role="menuitem" _jobid="$value['jobid']" onclick="selJob(this)">$value[name]</a></li>
                              <!--{/loop}-->
                        </ul>
                  </li>
             </ul>
        </div>
      </div>
       <div class="form-group">
       		
            <div class="controls ml20">
              <input type="button" class="btn btn-primary" value="保存更改" onclick="account_submit()">
             
            </div>
      </div>
       
    </form>
</div>    

<script type="text/javascript" reload="1">

	var orgsel_html=jQuery('#nav').html();
	var lastusername = '{$user[nickname]}', lastpassword = '', lastemail = '{$user[email]}', lastinvitecode = '', stmp = new Array(), modifypwd = true;
	var pwlength = 0;
	var strongpw = new Array();
    var ignoreEmail = false;
   	addMailEvent($('email'));
    checkPwdComplexity($('password'),$('password2'),1);

function account_submit(){
	//获取用户部门 并添加到form中
	/*jQuery('#selorg_container .nav-pills').each(function(){
		var el=jQuery(this);
		var orgid=el.find('.orgid').attr('_orgid');
		var jobid=el.find('.jobid').attr('_jobid');
		if(orgid>0){
			jQuery('<input type="hidden" name="orgid['+orgid+']" value="'+jobid+'">').appendTo('#accountform');
		}
	});*/
	//判断用户名
	if($('username').value=='' || $('email').value=='' || (($('password').value!='' || $('password2').value!='') && $('password').value!=$('password2').value)) return false;
	var p_chks = $('accountform').getElementsByTagName('kbd');
	var flag=0;
	for(i = 0;i < p_chks.length;i++){
		if(p_chks[i].className == 'p_chk' && p_chks[i].innerHTML != ''){
			return false;
		}
	}
	//判定微信号和手机
	var phone=$('phone').value;
	if(phone!='' && phone.match(/^\d+$/)==null ){
		$('phone').focus();
		showmessage('手机号码不合法','danger',1000,1);
		return false;
	}
	var weixinid=$('weixinid').value;
	if(weixinid!='' && weixinid.match(/^[a-zA-Z\d_]{5,}$/)==null ){
		$('weixinid').focus();
		showmessage('微信号不合法','danger',1000,1);
		return false;
	}
	
	ajaxpost('accountform','ajaxwaitid','return_edituser');
	return false;
}
function succeedhandle_edituser(url, message, values) {
	showmessage(message,'success',3000,1);
};
function errorhandle_edituser(msg,values){
	showmessage(msg,'error',3000,1);
}


</script>
<script type="text/javascript">
jQuery('.left-drager').leftDrager_layout();	
</script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}-->